Add customizable state handling
Change arguments for custom state handlers

Changed to better match the arguments passed to the after*State
callbacks.
Undo sourcemap generation