Lots of improvements

Hi,

I forked from Daem0n, which already had a number of fixes and improvements, and I have since made a few myself. You might want to merge these to your own repo.