refactoring for front end v2