factor out status check