Modified code for correctness