Working version.

Functions all generated correctly using class.prototype.functionName to
make them accessible.
Constructor parameters now correctly copied from __construct function.