Whenever I feel overwhelmed by, or lost in, the code I’m writing I take a few moments to go through it. Adding documentation, doing small refactorings etc. I find it helps me get back the grip and focus in on the things I need to change. Before I had a bad habit of getting unmotivated.