Complete functions for assignment 2