More polished vpeter's patch