reorganized functions between parser and renderer