kostas - refactoring of Agent