optimize timer checking logic