add cvs and image files generation
code refactoring