Fixed dangling pointer
Added file output functionality, for conversion between file types