Lots of fixes.
Merge pull request #250 from Clashnia/hqm

Lots of fixes.