refactor application context strucure