finished the functions