Created general output method for handling response formatting.