working stat funciton