refactor relations