Refactor front-end