Updated class to support iOS 5.1 + (5.0 too probably)