detect function boundaries and add comments