Add contains algorithm