Re factored code to remove come functionality to a base class.