Better document.ready handling