Turned into pure JavaScript.