finishing the functions