Reformatted code in the Mantid style.