updated refactor to separate out status function