Moved some logic into mapbuilder where it makes more sense