This function and every function throughout the PR needs JSDoc