Fix license header
Fix broken code after reformatting
Fix missing imports after optimise