Use push instead of referring to the last element.