cleaned up JoinScan and added tests