Refactored some code to follow Apple's best practices for obj-c