Added better documentation to functions (probably not spelled correctly)