Proper monad imp

supports user interaction

(note: still contains lots of code to be deleted)