Writing to file scripts and executing, lot of garbage and testing code