Improved colour checking code