relation: better code and more tests