Merged in all Tim's sparql changes