refactor element_tostring -> inline