Script ready for daily use

Made some major changes and fixed bugs. This script is now ready for
daily use, and works in all browsers.