added more unit tests and changed factories