changed the grid parameter in the new tile function to merged_grid