Initial version of app. Works but needs refactoring