Fixed a few problems, formatted code and optimised imports