Made loadMap more general.