Install cocoapods and minor refactoring