Refactor statistics and metrics out of liipy-demo