added more tests, refactored factory implementations