Master rebase

Adding a load of stuff from trunk, rebased from futuresimple :+1: