added functions to get topic name and check for valid topic now that topics are in multidimensional array