Added document.ready() and main method