replaced duplicate status check with single one