Replaced NSAutoreleasePool with @autoreleasepool blocks to allow compiling with ARC.