Changed the code a bit.

Also made the plugin to work on all directories