minore refactoring in def_method