refactor application structure