Added support for file writing