pulled in code from the original repo before the backward compatibility was removed and fixed a couple of things to make it work on iOS 6