better setup from tables, some clean up