totally refactored the handling for depth in the CmfHelper

/cc @dbu