Replaced class_eval with define_method