states now features a "before" and an "after" handler
make states "before" and "after" handlers configurable