major definition reorder: table creation first then functions