miscellaneous refactoring and playing around with maps (now disabled)