finished refactoring frontend