simplify each, change IEFE form