refactor app