Feature/refactor relation

/to @ritch 
add a description here to make the docs clear