Added is_empty check.