Removed some of the joins to replace with couts.