copied and changed
copied a bit from pacman-