Add is_natural and is_legal functions