602 hmwk 6 optimized a bit