Another iteration of OO improvements and adding unit tests.