Reduce complexity in cal.rb