major app refactoring