Refactored ClassFactory to use prototype.

Prior to refactoring the Class generated by the Factory produced around
40k operations per second. After refactoring the Class produce around 120k
operations per second!