Added extensibility

Code has been refactored to allow extensibility.