Move from literal prototypes to assignments

The existing object literal assignment for prototypes was fragile and
did not necessarily preserve constructors. In order to use the
'inherits' utility method from Node, every prototype method is now
individually assigned into the relevant prototype.