just finish the function