Reorganized parsers and added internal read/write code.
Also added a confirm close dialog.