move script to a module implementation