Some questions and comments, and a little code

Congratulation on crashing Firefox and making me force my computer to shutdown.

I'm not 100% what's going on, but I think the main problem is that you are trying to append the same node more than once. Check out the comments in the commits.