Code and JSDoc cleanup of issues found during inspection.