Profiling: added joins to minimize database requests