Merge pull request #2 from Sauyon/master

Bunch of bugfixes, thanks Sauyon!
Priority queue