Finished refactoring front-end code for now.