Fixes #10

The implementation is pretty naive. We have to test with big catalogs
to see how it degrades the performance, and eventually calculate it in
parallel