Converted to Python3; more documentation