refactor app and routing