refactoring into separate app file