class diagram added. refactored factory