Improved priority colouring and merged latest tweaks from upstream