added a small helper function to identify an empty mask; i.e., a mask that masks no square
implemented functionality to manage the cache and to reduce the number of useless cached configurations