adding factory pattern demo