Modified for support of iOS 6.1