Added some comments
Improved the boundary checking on th read method