extracted top level script to its own file