size_t instead of int here to support >2G