Joins updated

- ManyToOne joins are now working correctly.
- OneToMany code cleanup.