Lint warnings & a little optimization

some lint warnings spotted in code_climate. 

also an iteration that was using `elements.length` that should be faster