Extensive changes to how logs are stored. Added CSV support and better file appending.