refactored the app framework