add comments and api function