flag day. removing global variables and using hash.