My CBT-I pdoc (a sleep psychologist) explained that for Melatonin to work, one needs a very low dose and to take it not at bedtime, but about 5 hours before you plan to go bed.
I used Melatonin in the past but it did not work, so I stopped. That was some time ago. It turns out, I did it wrong in two ways: took megadoses and at bedtime.
For a week, I have been taking 300 mcg (not mg, mcg) several hours before going to bed. It seems to work. Knock on wood. Will continue with this regimen.