Changed int to NSInteger to avoid iOS 7/64bit warnings