Added queue for stat handler

We were getting issues with all of the stat handler threads (handler,
sql, etc) running concurrently (multiple instances of same MetaData
key/value pairs).
So I have now implemented a queue so the main thread doesn't wait, but
only there is only one worker thread, avoiding multithreading problems.
Adding unique constraints

Just making sure of uniqueness of relevant columns.
Merge pull request #102 from dannybutler/master

Added queue for stat handler