Refactor the code, in particular: https://github.com/benchflow/collectors/pull/54/commits/af97e2b007071c83406dd190b4271a7da3f235f2#diff-d6e9f78d4340c17360d3af9660f76ff6R69