CLN: refactor of csv

moved code to fmt/CSVFormatter
moved block and index formatting code to internals/index