More improvements to the greenness algorithm