Ok, I was able to resolve the issue by converting all the string processing of the entire function into a stringbuilder. Then, at the end, I simply do one conversion of the stringbuilder into lcHtml.
I have now a processing time within a second. I will continue to optimize my code to take care of that.
Thanks