Merged version with Datawriter