Refactor dotfiles script