added to_file method, refactored some code
added config/environment; updated README