Add profiling for n+1 queries. Make changes based on gem