Refactor widget.getVariable() to have better behaved parameters