Code cleanup and reformat.