fix superfluous event generation on assign; break up large functions