Added to_csv method to model

Also did some beautify (ruby-style-guide) refactor in files I changed something

[#251]