Pull request of Brendan's latest changes for them to count as commits :)