Added document writer and factory