Merge pull request #14 from maxrp/master

Turn cleanup() into an atexit() handler, simplify signal registration, exit with sigcode