Porting of modules

You can move this js code to the according place. See #204.