rearranged, finished metric generation