Refactor bgpicker