Polished latest pull request

Fixed formatting, added CSV mode conditionals, etc.