Generalized the construction of gui wrappers