Added support for daemonizing

Fixes #39