some commments, error checking and inBounds checking
more comments