Refactor part of code to not use DOM for introspection but already
existing Gadget methods.