refactor code: introduce interfaces