Major refactoring, API change

- Rewrote most of the app
- Fixes #126
- Fixes #156