Reworked the solution to #2 to avoid having to use begin-end blocks. This emulates how the readline repl behavior works. Fixes #2