moved rendering to not rely on document.ready