Cleaning up relationship code