Fixed indexation for several count queries were not having desired effect. Cleaning up the code and reorganizing.
Merge branch 'master' of https://github.com/sibbr/dataportal