Added capability to execute in background (daemon) and refactored logging. Closes #1