Fixed missing parentheses for for and if statements

### Problem
jshint was complaining about missing parentheses

### Fix
clean up code and add parentheses