Refactoring

Split the concerns into separate classes with interfaces describing the behavior. Have a look at it.