fixed some bugs and the EA and SA now properly remove some mappings at the appropiate time.