Refactor and modularize application.