some simplification of the code and a change to the ahlloween pattern