modified 'contains_valid_numerals_for_base' character comparison to read more logically