Implement daemon / foreground