Slight refactor of the container check.