Reformat code and optimize imports