This follows on from my StackOverflow question