Major changes and improvments

Cleaned up the code, fixed the memory leak in IE 9, and other small
changes. The code is now only on 132 lines and the size is only: 888
bytes