refactor step handlers to remove redundancy