some frontend refactoring and comments