Make selectWidget a local function instead of a method