refactored to make use of join