support for multiple tables and new clean flag