structure change; moved scripts to code