reformat, optimize variable use