implemented enter/exit pattern