refactored sentence.rb script