full iteration, mainly adding support for opening the map from the Prolog side