Added function to have jquery wait to run code until everything has loaded