refactored the frontend