Debugged script and improved documentation.