implemented TPC encoding