Added method implementation and a test driver method.