Added lots of tests. Coverage up around 85%.