completed functions for the assignment