Full code for eager loading