Further abstracted functions from scopegadgetwidget. Tested and works.