shrink psuedo code