Changes to reflect python best practice

Adds a future import and changes around the things that would be incompatible with it, as well as cleans up some code