update the contain method to speed up