People often underestimate the power of thinking. When I spend more than 2 hours fixing a bug or finding a solution, I usually step back and go for a walk, watch a movie or do something else. But my mind keeps working. I recreate the flow in my mind and try to deduce why something is not working. 90% of times, I find the problem within 30 minutes of stepping away from the computer.