Reformat some code and add a BSD license to the top.