Unit test changes and minor tweaks

Committing unit test changes and some minor tweaks throughout the main
code.