combined the comment parsing into one base function