Fix inconsistent naming and indentation

Basically, I had the fix (that Thomas has committed) added, but I couldn't commit sooner, so I just merged mine, which uses exactly the same logic but fixes errors that circle ci gives (actually jslint).