did some ninor updates on script and added error logging to update_dominant_category.php