Made a number of changes for displaying results from queries