Added filewriting ability