tweaking code for adding relationship