cleaned up some gray code