Moved read_symbol into its own function