WIP on implementing single stepping.

Misc. bugfixes.