refactored app, fixes #5