refactored parts of the app