separated table into separate function