Multiple changes.

Added in support for new API. Written by a friend on Python. Commenting
and changing variable names.