refactoring the step file
Pulling out more mercurial operations from the step file