Separate application logic from directory monitor