changed NSInteger to NSUInteger to suppress compiler warnings