Fixed addElement & added some comments