remove retain/release for automatic memory mode and fix ambiguous boolean logic

This fixes errors thrown by Xcode 5 about retain / release / dealloc not being allowed in automatic memory management mode. It also fixes errors about ambiguous boolean logic caused by having && and || in an if statement without parentheses. There was also one unused variable causing a warning.