Re-factor into GUI and non-gui versions

Re-factor into a separate non-GUI exporting utility and GUI viewer.