totally refactored the handling for depth in the CmfHelper