complete the two functions