Taken Alex's changes for PyLong 1.3