Fixed pixel detection and now outputs correct pixel colours.