Code for Team5 (representations of bit patterns). Code provided by Michael Grazebrook