simplify implementation of auto logout