code cleanup for grid