Use size_t instead of int where appropriate