Sidebardata function changed to support fetchAll