move script function specific code to the right file