Adding document ready detection