cleaned up metric generation portion