added tests and scaffold for relations