Added the remainder of the handed out code.