pie logic