added enter/exit state handlers