refactor, correct file write and enums changes