Refactor turnip step code