Updated daemon. It is now more robust and doesn't need to be ran within a bash while loop.