Rewrite the gadget in an object oriented way.