Improving hw3 solutions