changed all size_t vars to int