refactor watchDirectory to take an object as an argument
refactor tests