refactor and minor table changes