adapted script to new structure