broke table down into smaller logical functions