refactoring - adapter as a separate class