int -> size_t where appropriate