hw2, task 3.

+ small style fixes.