Fixed the failing unit tests, added new tests