Refactored the app structure to make it more output friendly.