redistributed bulk of map making code to be in a function rather than a script for easier use
fixed some silly bugs and made the make_maps function a little more sane