Fixed genGrid function to accept size parameter per assignment instructions