refactored ch1 with a class, added rspec test