Fixed up the code some more. Need to comment still.