Amend to use delete instead of setting as undefined and appropriate use of ++.