Module extension

Rewrite the script with modular approach