#31, more unit testing coverage and fixing