fix lint warnings and reformat code