added the withGadget function
simplified hash to use withGadget