Fixed prints to work for Python3, and adjusted minor bug.