Starting back from scratch to make more modular and testable code