reafactor and csv fixed