added delaystatus funciton & abstrated setstatus for code reuse