added mapcode calculations