Simplify click handling.
Add a wrapper for sigaction().

Various other fixes for mysterious problems without any explanation.
Minor cleanup.