added null check to deletion code and changed each iterators to pass NULL for elements