Progress on the C daemon, need to do some multi-threading next