added argument defined check to onDocumentReady(); file mode changes