added factory desing pattern
added factory desing pattern