added daemon support