Bind to DOMContentLoaded event

Worked better in my release environment. Also 2 functions werent terminated.