add provider model. various bugfixes.