finish refactoring frontend