Better implementation of type provider