Added functions to $document.ready