refactored, added option to use watch directory