completed function assignment