tasks 2 - 4 (not yet perfect)