added check for pixel intensity