finish the function code of analysis part