Refactor into a standalone app - v0.4