Convert more to using six and remove some redundent code and fix some bugs