changed to use the define_method in example code