Updated intersection building to use an hql query

This should yield enormous speedups as 1 query will run instead of
potentially many thousands or more