revert works, but very dirty impl