Fixed warnings involving converting from size_t to uint64_t. 

Also eliminated unnecessary code.