Working version
Small tweaks to file output
Fixing enum, even though it's not really used