Restructuring to improve side effects

This fixes #2 again by improving the system to deal with effects on
either side (like Heal Block). Also fixed a couple of bugs with some
very common functions (foreach and forever).