orig version for hw, v2 is my improved version