Add rev4 implementation, update test code