added writing modes per @bembjb's feedback