Refactored factory. Removed exceptions