Added comments; refactored functions

Changed pointers to const pointers. Changed function names to better
represent what they accomplish.
Returns on failed file io; index is now size_type