add hw3 week4 optimisation