restructured the steps handling