loading of tables and more error checking implemented