But my job as a software developer involves brain-intensive work, and when I come home after work, I work on hobby software development projects, which means my brain is working intensely whenever I am awake. That may be the stress leading to my sleep issues. But I can't give up my hobby.
All doctors want to do is put me on prescription pills for the rest of my life, and all of these prescription sleeping pills are addictive. So I have been avoiding prescription meds.
Then I discovered that magnesium supplements largely solves my problem. I hope this helps someone: If you have sleep issues try Magnesium L-Threonate. Magnesium fixed two issues for me: sleep and muscle stiffness.