Improvements to unit tests, cleaning up issues from previous commit