added splice function