Committed code 'forked' from CodePlex.