Some refactoring and uniTable fixes