changed code and syntax for python 3.4 instead of 2.7