tests for application and refactoring