Pre bug metrics with refactored bug query

Contributes to #189 and #197