Debugged script. Removed debug logs