using document.ready for encapsulation