added sort order for search and clean shutdown