Messy implementation of char array compress. Will clean up