Added file writing capability. but not working as expected.
Needs a fix some time later.