Refactor history.zsh