Wrote functions to write relationships to file. Fixed terms parsing. Still need to handle users.