Completed the functions