transferred functions from jbntools.cmaps