refactored the front end