Added table creation logic