Moving a bit of functionality from mirebalaisreport module