refactor relation