Converted to CV 2. BW functionality implemented