refactor createTable