Merged Daves code with Jairos. Should work straight after a git clone.