Refactor frontend