adds provider and fixes bugs