refactor code

front end refactoring