cleanup and hardening

additional unit tests, code cleanup in prep for initial beta release.