refactoring startApp to add callback as a parameter and removing redundant varaibles