First draft of cyclicEncode