Rewrite queue tables. Minor validation fixes. Minor refactoring.