Fixed it

Doesn't taint the global scope to much. Needs the callbacks form the dom though.