Basic code refactor, python 3.4 syntax support