Do a better job at handling errors + fix ordering for tables