Added checking for valid symbols