Added is_legal_symbol to the helper functions too