Added logging
Now using Angular's $document.ready