refactoring front end