Seems like I finished the encoding part. Both cases are literally the same except the second case has a different while loop conditional and you have to decrement an addition int. Haven't tested if it works since I need to start on the decoder