added comments
added JSDocs