Updated cloud code to check catID too,