refactor to directive, support encounters.