added some file writing support/not finished