encounters and refactoring