Completed functions for the assignment