Refactor for api-piecheese