add a comment explaining what this function does, preferably w/ jsdoc for each param.