added eq operators for relations. Also minor code improvements.