function goto_next_step rename and removal of unused variables