edited some stuff for iOS 7 compatibility, still needs some more debugging