added document ready

Fully tested and working