rewritten task 2 so it can be used by task 3