Tidy up code, move general queries to trigger based on regex.
Merge pull request #5 from michaeldever/master

Tidy up code, move general queries to trigger based on regex.