added chain of responsibility pattern