Added grid validation to not move outside