Added function testing of relations, added many tests