Pishemdad without the map and checking the inputs.