Remove unused code; remove (mostly) duplicate masters; PEP8! r=bhearsum

--HG--
extra : rebase_source : 6f651cd2954dfd5311fe3a85da62f34c61f344d9