Batch function, and adding/removing relations

I added a batch function and functionality for adding/removing relations.

I'm happy to make accommodations by changing style where applicable, and i know the tests could be a little more thorough.  Let me know if you've got any suggestions you'd like me to implement before merging.