added count() and refactored factory