Replace class_eval with define_method