Large update

I've merged in the best commits from forks of Dreamy. It seems to work quite well, so you may want to do the same.