refactoring main app v1