Lint warnings & a little optimization

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