update cask, refactor "duplicate" functions