added bitwise and (hopeful speed improvement)