better version of task 3