Wrap each section of where() in parens

This fixes where('X OR Y').where('Z') case
Use built-in function