Modified code for Jordan