Added assert checks for out of bounds cells.