Quick update for 3.3 - really needs review/refactoring

Hi,

Updated this quickly for version 3.3, including a few extra changes.

You might like to review it and/or improve upon this.

(It's dirty but works, I might work on this if/when I have more time. In the meantime here's a PR ;)

Cheers, :+1:
~ Daniel