simplified daemon waiting code