Cleaning up the table creation code