improve extractpot script