Optimise imports and format code