Refactor data provider, fix serialization provider bugs