added adapter pattern code