Debugged version

Debugged version