rolled back previous commit for N+1 issue. Will refactor and re-submit