Reversion and clean up some unused code