performance improvement by using a shallow clone and splice as opposed to JSON parse/stringify