trying to implement rev by pivot