client: add comments, fix detect function name