solution of task 2: the ugly
solution of task 2: the bad