task 4 solution implemented, first part