condensed the combined table code