When in doubt of a program, RedoIt. RebuildIt?. StartFromScratch. RedesignIt?. Once you have a completed version that is easily maintainable, your goal has been met. Now you have efficient experience to do something better. Don't be afraid to totally scratch the entire last model of a program. Many times, especially in game programming, people think they have the ultimate GameEngines, when in fact they haven't created an engine at all! Always leave the possibility open that you may be wrong, or at least that you may be able to do it better one more time.
Related: OptimizationPattern | SatisficingArtifact