new daemon test and little refactoring