Technique #1. You can't improve your code if you're terrified to change it. That's where tests come into play. Think of them as refactoring insurance. Go ahead, make as many tweaks as you need to. Each step of the way, your tests will let you know if you've made a mistake.