Changed the code to run immediately instead of waiting for the dom to be ready.