Add types and rename state to avoid confusing dialyzer
Release 22 with appup