Refactored VM status detection