HW rewritten. Added task 2 solution