converted to textnodes and appendChild instead of innerhtml for performance