Refactored the app a bit