Used a BitSet instead of boolean array