Added file writing capabilities