James C - started chapter 2
James C - improved bit-handling