demorse.rb: refactor