Changed a few types from int to size_t