Added some comments and JSDoc