Week3 working blocking code