Built, hopefully working, functions for building maps, and trees