Some code clean-ups in StateMachine and ZoomBorder