Made compatible for use with additional_javascripts.
Made cleaner.
Fixed a line left from debug, and added comments.