Refactored step code a bit to simplify.