Added md5 hash and file writing