fix and optimize
create cvs file, not completed