Function dispatch instead of giant switch

Also renamed cask to old cask