Added a lot of unit tests