main refactoring
minor fixes
check data for modes, less verbose
tab separated csv