adding querywidmaster function