Integrated all of Chris's code.