refactor the front-end