Improve getTable function to add additive elements