changed logic to bit