most of Tutorial5 (joins) implemented