Converted from 5.1 to 5.2 with a few minor modifications.