Completed two functions, and provided test code commented out