refactor the undefined_steps method

some small changes to the undefined_steps