Fix Monoid classcast exception: referring to this apparently refers to the Class, because it is in a static method. Created a self variable, to contain the newly created object, and return that reference, instead of this.