some code cleanup, map bug fixes

yuuuup. still trying to figure some other more impressive shit out