refactor application