Added unit tests and fixes from running them