Fix ordering issues using the contain function