Updated to 2.0, for CC 1.63. Shortened by 200 lines