Further refactoring as a standalone application.