Refactor front end