version 3

A few updates so that this works in python version 3 as well as in version 2.