I have had problems with my sleep rhythm as well. But I advice you not to take Melatonin.
Sleeping problems is like a vicious cycle because the more we realize we have it the more severe the problem gets, in other words it's very psychological.
So what do you do ? It's simple. Always wake up at the same time in the morning. That means it's going to be painful in the beginning as you have started falling asleep later and later. But trust me using the morning to adjust it is the best as you will then have to adjust the time you go to bed accordingly.
Remember that laying and just relaxing in the bed ( when you can't fall asleep) also helps you to recharge, so don't feel stress about having to fall asleep right away. It is this stress that messes it up in the first place.
A very important things is also the routine before going to sleep. I think one of you major problems is that you are so connected to the internet that it takes a long time before your body is able to unplug. Have a no internet free zone atleast 1 hour before Sleep it does wonders. Read a book and relax instead.
Final tip. Using your mind to relax your body takes time. A better way is to relax your body and then you mind will follow. I have a practice I used before where I tighten muscles starting from the feet and work upwards to the face. I first tighten my feet and I do that when I breath in. I hold my breath for a bit and then release my breath in the same time as I relax the body.
Hope this can be useful