Added comments and improved sytax of 'santize' and 'writeLines' functions