Centralize decoding. Make state change funcs private.