* Code refactored to revealing module pattern
* Fixed some problems with directory paths with or without trailing slash