Modified code for reflect