refactor unstep handling, not any faster but easier to understand