Refactor views utils.
Refactor relations listing code.