Update handling of Python input methods to work better and minor comment changes.
Fix wrong debug paths for Python 3.
Remove unneeded code.