Code reformat and cleanup