traps refactoring