Correct JavaScript function names and documentation