diff --git a/src/Form/LatexForm.php b/src/Form/LatexForm.php
index f9a535e..ddb9acc 100755
--- a/src/Form/LatexForm.php
+++ b/src/Form/LatexForm.php
@@ -4,7 +4,7 @@
  * Contains \Drupal\latex\Form\LatexForm
  */
 namespace Drupal\latex\Form;
-
+use Drupal\user\Entity;
 use Drupal\Drupal\latex\Form\FormInterface;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Form\FormBase;
@@ -16,8 +16,6 @@ use Drupal\Core\Ajax\HtmlCommand;
 use Drupal\Core\Ajax\InvokeCommand;
 use Drupal\Core\Ajax\InsertCommand;
 use Drupal\Core\Ajax\AppendCommand;
-
-
 use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
@@ -35,116 +33,122 @@ class LatexForm extends FormBase {
     return 'latex_form';
    }
 
-   
-  
   public function buildForm(array $form, FormStateInterface $form_state) {
-     
-      $form['latex']['nodeinfo'] = [
-        '#type' => 'entity_autocomplete',
-        '#title'=> t('Node Title'),
-        '#target_type' => 'node',
-         '#suffix' => '<div  id="upd1" name="hello"></div>',
-           '#ajax' => array(
-             'callback' => 'Drupal\latex\Form\LatexForm::updateData',
-             'event' => 'change',
-             ),
-          ];
-        
-         $form['latex']['token_tree'] = array(
-             '#theme' => 'token_tree_link',
-            '#token_types' => array('node'),
-            '#show_restricted' => TRUE,
-          
-           '#weight' => 90,
-        );
-    
-       
-          $text= " \documentclass[12pt]{article}
-              
-               \\title{".$title."}
-                 \author{".$author."}
-                
- 
-               \begin{document}".$body."
-               \\end{document}";
-          
-        
+    $form['latex']['nodeinfo'] = [
+      '#type' => 'entity_autocomplete',
+      '#title'=> t('Node Title'),
+      '#target_type' => 'node',
+       '#suffix' => '<div  id="upd1" name="hello"></div>',
+         '#ajax' => array(
+           'callback' => 'Drupal\latex\Form\LatexForm::updateData',
+           'event' => 'change',
+           ),
+        ];
+
+    $form['latex']['noad_load'] = array(
+      '#type' => 'button',
+      '#ajax' => array(
+           'callback' => 'Drupal\latex\Form\LatexForm::updateData',
+           'event' => 'click',
+           'progress' => array(
+              'type' => 'throbber',
+              'message' => 'Loading node...',
+            ),
+           ),
+      '#value' => t('Load'),
+    );
       
-      $form['submit']['content'] = array(
-        '#type' => 'submit',
-        '#value' => t('submit'),
-        
-        
-      );
+    $form['latex']['token_tree'] = array(
+     '#theme' => 'token_tree_link',
+     '#token_types' => array('node'),
+     '#show_restricted' => TRUE,
+     '#weight' => 90,
+    );
 
-       
-      return $form;
+    $form['submit']['content'] = array(
+      '#type' => 'submit',
+      '#value' => t('Submit'),
+    );
+    return $form;
   }
   
-  
-  
-
   public function updateData(array $form, FormStateInterface $form_state) {
-  
     $ajax_response = new AjaxResponse();
     $nid = $form_state->getValue('nodeinfo');
     $node = node_load($nid); // $nid contains the node id
     $title = $node->get('title')->value;
     $body = $node->get('body')->value;
-    $author = $node->get('uid')->value;
-    $text= " \documentclass[12pt]{article}
-              
-               \\title{".$title."}
-                 \author{".$author."}
-                
- 
-               \begin{document}".$body."
-               \\end{document}";
-       $output= $form['latex']['edit']= [
-         '#type' => 'textarea',
-         '#name' => 'edit',
-         '#id' => 'edit-edit',
-         'class' => 'form-textarea resize-vertical',
-         '#title' => t('Document'),
-         '#value' => strip_tags($text),
-        ];
-        $ajax_response-> addCommand(new HtmlCommand('#upd1', $output));
-  
-        return $ajax_response;
-    
-      }
+    $uid_array = $node->get('uid')->getValue();
+    $author_id = $uid_array[0]['target_id'];
+    if($author_id != 0){
+      $account = \Drupal\user\Entity\User::load($author_id);
+      $name = $account->getUsername();
+    }
+    else $name = 'anonymous';
+    $created_date = $node->get('created')->value;
+    $readable_date = date('F j, Y, g:i a', $created_date);
+    $file = $node->get('field_image')->getValue();
+    $fid = $file[0]['target_id'];
+    if(!empty($fid)){
+      $file = File::load($fid);
+      $url = $file->getFileUri();
+      $file_path = file_create_url($url);
+    }
+    $text = '\documentclass[12pt]{article}
 
+              \title{'.$title.'}
+              \author{'.$name.'}
+              \date{'.$readable_date.'}
+              \begin{document}
+              \maketitle
+              '.$body.'
+              \includegraphics{'.$file_path.'}
+              \end{document}';
+    $output = $form['latex']['edit'] = [
+     '#type' => 'textarea',
+     '#name' => 'edit',
+     '#id' => 'edit-edit',
+     '#attributes' => array('class' => 'form-textarea resize-vertical'),
+     '#title' => t('Document'),
+     '#value' => strip_tags($text),
+    ];
+    $ajax_response->addCommand(new HtmlCommand('#upd1', $output));
+    return $ajax_response;
+  }
 
-    public function submitForm(array &$form, FormStateInterface $form_state) {
-     
+
+  public function submitForm(array &$form, FormStateInterface $form_state) {
     $file = \Drupal::request()->request->get('edit');
-   
     $nid = $form_state->getValue('nodeinfo');
     $node = node_load($nid);
-     $title = $node->get('title')->value;
-    $filename = "$title.tex";
-  
-    $myfile = fopen("$filename", "w") or die("Unable to open file!");
-
-    fwrite($myfile, $file);
-    $file = \Drupal::request()->request->get('edit');
-    
-    fclose($myfile);
-    shell_exec("/usr/bin/pdflatex --interaction batchmode $filename");
-
-    $filename = "$title.pdf" ; // of course find the exact filename....        
-    header('Pragma: public');
-    header('Expires: 0');
-    header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
-    header('Content-Type:  application/pdf');
-    header('Content-Disposition: attachment; filename="'. basename($filename) . '";');
-    header('Content-Transfer-Encoding: binary');
-    header('Content-Length: ' . filesize($filename));
-
-    readfile($filename);
-    exit;
-    drupal_set_message("Operation Successfully..");
-     
+    $file = $node->get('field_image')->getValue();
+    $fid = $file[0]['target_id'];
+    $file = File::load($fid);
+    $path = $file->getFileUri();
+    print_r($path);
+    die();
+    if(!empty($node)){
+      $title = $node->get('title')->value;
+      $filename = "$title.tex";
+      $myfile = fopen("$filename", "w") or die("Unable to open file!");
+      fwrite($myfile, $file);
+      $file = \Drupal::request()->request->get('edit');
+      fclose($myfile);
+      shell_exec("/usr/bin/pdflatex --interaction batchmode $filename");
+      $filename = "$title.tex" ; // of course find the exact filename....
+      header('Pragma: public');
+      header('Expires: 0');
+      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+      header('Content-Type:  application/tex');
+      header('Content-Disposition: attachment; filename="'. basename($filename) . '";');
+      header('Content-Transfer-Encoding: binary');
+      header('Content-Length: ' . filesize($filename));
+      readfile($filename);
+      exit;
+      drupal_set_message("Operation Successfully..");
+    }
+    else{
+      drupal_set_message('Please click on "Load" first', 'error');
+    }
   }  
-  
 }
\ No newline at end of file
