complete the functions for course assignment