changed table buiding method