changed mapalgrebra to except a mask parameter