finished writing the function.