Task 2 (mutable version)