Changed code completely
Corrected the code