added more logic to combine items