Added support of reading and truncating existing files
Added support of logging