refactoring the front-end