merged @jtamboli 's pull request into this branch.

and updated some int/nsinteger/nsuinteger handling along the way.