refactoring to support nested step evaluation