added JSDocs comments
added JSDocs comments. added additional helper functions.