Implemented changes for #659 and #663. Need feedback if setup of CSVs is ok.