Modified daemon script (cleaned) 100% working and tested.