Updated to take into account the map's orientation