Refactoring of isAlive() method