Added: joins to SQL
Removed: obsolete code.
Removed: more obsolete code.