Made modifications to the code