Added a debug statement and changed amount from unsigned int to size_t