added the active state function