started to clean up code

documented all in AppDelegate