Daemon copied from labs-backend