refactor front end