Uses NSInteger to avoid 64bit arch warnings.