Fix the modular structure.

One of the scripts functioned as a module too. Now the script
and module parts are separated.