cleanup mapcode implementation