Cleanup of the affect filtering code.