adding work sharing algorithm