Reformat code + minor code cleanup.