replace attributes method with ruby 2.0 to_h
refactor tests and code into separate files
refactor tests and code into separate files