make this work with all tables