moving app to main funciton