create .to_csv method & light refactoring