update grid class to create rows and raise error if incorrect input