refactored to compile under XCode 6.1 beta