Separated code for state, Flash, and deprecation.

Includes deprecation warning console messages and the `debug` option to
disable them.