Fix cs issues, improve encodeText method / call