changed size to use size_t instead of int