Refactor application