Added some unit tests and a few minor updates