Use unsigned short instead of int in a few places that makes sense to do so.