Added locking and daemons. Should work somehow.