improve quality metrics, add tests

Signed-off-by: Richard Marko <rmarko@redhat.com>