insertEffects: cleanup
insertEffects: got rid of most unbound globals