Added and fixed unit tests