refactor how status code gets pulled into response creation