Renamed size to numBytes
Changed 50000 to 5e+4
Simplified checkError