Update code for HW9 part 2

TODO:
1. Get the test result for part one, 10000 bits. I am doing this. But it takes like 30 minutes to run once. 
2. Fix bugs if they were found. I tried the data from lectures. They still don't match my functions :(
3. Write-up.