added insert method for arrays