add singleton and factory pattern
add singleton and factory pattern