Resolved comments from reviews. Added tests to get coverage up. Fixed bugs found by new tests.