More linting fixes and optimisations