A bit of refactoring on When and Then commands.

Also some more method comments.