code and tests for Table