Add debug mode and few fixes. Note the way to call the program has changed to a long option format (--directory, --pattern, --prefix etc...)