Updated mapcrypt function