Changes required to compile with ARC.

I made the changes required to compile with ARC enabled. Tested in emulators and on a couple of devices.