added documentation and adjusted the script