Added explicit table names, fixed some relations.