task 2 optimizations