Various fixes, including reformatting the entire file