Added trimming to queries
Merge branch 'dev'