Added jsDocs style documentation to code