changed to ^Z for cmds, refactored to uses select for performance