sorting before returning list of libs