move all methods out of appDelegate and other things