replaced instance_exec with define_method