working on encoding for compression