finished all the functions