Corrected bug and added new grid functionality