rearrange line 82 to improve readability
updated to use INNER JOIN for multiple tables