Major refactoring of the Effect code