refactoring the original DIRAC code