Can anyone please help me to modify the code so that it runs faster?