Fix retain cycles and missing autorelease pool. TODO: incomplete

It looks like there are a few retain cycles going with the blocks in the SDK.

The reason is that some of the blocks are retaining self (http://stackoverflow.com/a/4352616/283899)

This PR is incomplete, but this is an issue that was affecting us.