added some daemon factoring and started the case manager daemon code