Updated buildGrid function to accept a mapData param