little define_method refactor