added rspec tests, refactored watcher