Refactor state update API, better error handling

Filters; more 403s, fewer 500s; added logging; less duplication