Implemented factory pattern.

Implemented factory pattern for multiple sending methods.