Completed functions for assignment.