Added refactoring of relationships controller and ensured a passing test suite