Added writing to local file