completed function definitions