Refactored js code and merged to the master

Pls move the FilesystemHelper into its own file.