refactored front end