Add callback-functionality to dirwatcher, fix possible infinite loop
Add test for dirwatcher