Time for action – Using state detection functions