Debugged the code