app refactor