solves some more problems including run length encoding