Move common logic to new core app

This is basically a huge refactoring. Common logic, templates, etc. is moved (mostly) from the manager app to a new core app. See #59