Refactor controls_if compose logic.

This function now tries to make the minimum number of connections and
disconnections possible, to avoid updating the server's block tree any
more than necessary.
Remove comment.
Make mutations persistent.

Removed redundant Add/Remove input Events.