Refactoring

fixes UI and flow of the application