Work on writing test cases.
Various small tweaks.