Updated structure to use sections instead of just writing straight to the file.